Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
Amrith Chandran
02-Mar-2026Overfitting is a phenomenon in machine learning where a model learns the training data too well, including its noise or random fluctuations, instead of capturing the underlying patterns that generalize to new, unseen data.
In simpler terms, the model performs very well on training data but poorly on test or real-world data because it has memorized specifics rather than learned general rules.
Key Characteristics of Overfitting
High training accuracy, low test accuracy:
The model predicts the training examples almost perfectly, but fails on new examples.
Excessive model complexity:
Very deep neural networks or high-degree polynomial models can fit every tiny variation in the training data.
Sensitivity to noise:
The model treats random fluctuations in the training data as meaningful patterns.
Example
Imagine trying to fit a curve through a set of points:
A simple model (like a straight line) might not pass through all points but captures the overall trend.
A complex model (like a high-degree polynomial) passes through every point exactly, including outliers.
The complex model overfits because it captures noise instead of the general trend.
How to Prevent Overfitting
Use more data: More training examples help the model learn general patterns.
Regularisation: Techniques like L1/L2 penalties or dropout prevent overly complex models.
Simpler models: Reduce the number of parameters or use less complex algorithms.
Cross-validation: Helps detect overfitting by evaluating the model on unseen subsets.
Early stopping: Stop training when test performance stops improving.
In short, Overfitting is when a model memorizes instead of learning, sacrificing its ability to generalize to new data.